﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace WatchDog
{
    class Program
    {
        public static TcpListener MyListener;
        public static DateTime LastConnTime = DateTime.Now;
        static void Main(string[] args)
        {
            //开启客户端链接端口
            MyListener = new TcpListener(new IPEndPoint(IPAddress.Any, 10084));
            MyListener.Start();           
            Console.WriteLine("开始监听10084端口");

            Thread CheckThread = new Thread(new ThreadStart(ListenerThread.CheckThread));
            CheckThread.IsBackground = true;
            CheckThread.Start();

            while (true)
            {
                TcpClient TempClient = MyListener.AcceptTcpClient();
                ListenerThread LThread = new ListenerThread(TempClient);
                Thread listenThread = new Thread(new ThreadStart(LThread.ListenClientConnect));
                listenThread.IsBackground = true;
                listenThread.Start();
            }

        }
    }


}
